package com.BahavioralPartterns.CommandPattern.example.invoker;

import java.util.ArrayList;
import java.util.List;

import com.BahavioralPartterns.CommandPattern.example.commond.Command;

public class Waiter {

	private List<Command> orders=new ArrayList<Command>();
	public void setOrder(Command command){
		if("bakeChicken".equals(command.toString())){
			System.out.println("鸡翅没有了！");
		}else{
			System.out.println("增加订单！");
			this.orders.add(command);
		}
	}
	public void cancelOrder(Command command){
		if(this.orders.contains(command)){
			System.out.println("删除订单！");
			this.orders.remove(command);
		}
			
	}
	public void myNotify(){
		for(Command command:this.orders)
			command.excuteCommand();
	}
}
